home *** CD-ROM | disk | FTP | other *** search
- Path: norconnect.no!not-for-mail
- From: kenneth@norconnect.no (Kenneth C. Nilsen)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: How works SetFunction ?
- Date: 17 Jan 1996 07:00:17 +0100
- Organization: NorConnect Internet Services AS
- Message-ID: <1619.6590T362T1266@norconnect.no>
- References: <30fb3c06@beachyhd.demon.co.uk>
- NNTP-Posting-Host: norconnect.no
- X-Newsreader: THOR 2.21 (Amiga;SOUP)
-
- >In a message of 14 Jan 96 UNREGISTERED VERSION wrote to All:
-
- UV>> oldfunc=SetFunction(library,oldFuncOffset,newFuncPtr)
- UV>> what is oldFuncOffset?
- >It is the offset in the library that you would jump to (in assembler) to call
- >the library function. For example, the Open() function in dos.library has an
- >offset of -30.
-
- No no, the oldFuncOffset is the actual pointer to the routine code of the old
- function. This will let you use the old function in your new routine:
-
- Here is an example. We have already opened intuition.library:
-
- [...]
-
- move.l $4.w,a6
-
- move.l IntuitionBase(pc),a1
- move.l #_LVOOpenWindowTagList,a0
- move.l #OpenMywin,d0
- Call SetFunction
- move.l d0,OldFunc
- beq.w Close
-
- [...]
-
- Close move.l $4.w,a6
-
- ;remember to make a routine to check if it's okay to set back the old function
- ;For that you need to compare the pointer you get after the next routine.
- ;if that and the OldFunc are not equal you cannot exit. Set back the pointer
- ;you get last and try again later..
-
- move.l OldFunc(pc),d0
- beq.b .noFunc
- move.l IntuitionBase(pc),a1
- move.l #_LVOOpenWindowTagList,a0
- Call SetFunction
-
- .noFunc rts
-
-
- OpenMywin:
-
- movem.l a2-a6/d2-d7,-(sp)
-
- move.l OldFunc(pc),a5 ;if the routine uses the A5 register DON'T
- jsr (a5) ;use this registre..
-
- movem.l (sp)+,a2-a6/d2-d7
- rts
-
- This will do as the original function, but here you can manipulate the data
- before and after.
-
-
- ---
- CREATIVE LINKS __ Kenneth C. Nilsen
- http://www.norconnect.no/~kenneth /_/\ e-mail: kenneth@norconnect.no
- "Everything you want" \_\/ Software & MultiMedia developer
-
-